Skip to content

docs(skills): add dpdata plugin skill#954

Open
njzjz-bot wants to merge 2 commits intodeepmodeling:masterfrom
njzjz-bot:skills/dpdata-plugin-skill
Open

docs(skills): add dpdata plugin skill#954
njzjz-bot wants to merge 2 commits intodeepmodeling:masterfrom
njzjz-bot:skills/dpdata-plugin-skill

Conversation

@njzjz-bot
Copy link
Contributor

@njzjz-bot njzjz-bot commented Mar 15, 2026

This PR adds an Agent Skill under skills/ describing how to create and install external dpdata plugins (Format.register + project.entry-points."dpdata.plugins").

Authored by OpenClaw (model: gpt-5.2)

Summary by CodeRabbit

  • Documentation
    • Added comprehensive guide for creating and using external dpdata plugins, including discovery flow, package structure examples, implementation steps, and debugging resources

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 15, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

📝 Walkthrough

Walkthrough

A comprehensive documentation guide is added explaining how to create and use external dpdata plugin packages, including the @Format.register decorator, plugin discovery flow, minimal example layouts, and verification checklist for proper plugin exposure.

Changes

Cohort / File(s) Summary
Documentation
skills/dpdata-plugin/SKILL.md
New guide documenting external dpdata plugin creation, including Format registration via @Format.register decorator, plugin discovery mechanisms, example package structure, pyproject.toml entry_points configuration, and debugging checklist for schema compliance verification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

dpdata

Suggested reviewers

  • njzjz
  • wanghan-iapcm
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs(skills): add dpdata plugin skill' is clear, specific, and directly reflects the main change: adding comprehensive documentation for creating and using external dpdata plugins in the skills directory.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 15, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 2 untouched benchmarks


Comparing njzjz-bot:skills/dpdata-plugin-skill (285cbdd) with master (d68b700)

Open in CodSpeed

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.37%. Comparing base (d68b700) to head (285cbdd).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #954   +/-   ##
=======================================
  Coverage   86.37%   86.37%           
=======================================
  Files          86       86           
  Lines        8086     8086           
=======================================
  Hits         6984     6984           
  Misses       1102     1102           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “dpdata-plugin” skill document describing how to build and distribute external dpdata Format plugins via pyproject.toml entry points, and updates .gitignore to ignore common local uv development artifacts.

Changes:

  • Add skills/dpdata-plugin/SKILL.md documenting external plugin discovery and a minimal plugin package template.
  • Ignore uv.lock and .venv/ in .gitignore for local development.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
skills/dpdata-plugin/SKILL.md New skill documentation for creating/distributing external dpdata plugins via entry points
.gitignore Ignore local uv lockfile and virtualenv directory

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.


So an external plugin package only needs to ensure that importing the entry-point target triggers the `@Format.register(...)` side effects.

## Minimal external plugin package (based on plugin_example/)
Comment on lines +62 to +68
def from_system(self, N, **kwargs):
return {
"atom_numbs": [20],
"atom_names": ["X"],
"atom_types": np.zeros(20, dtype=int),
"cells": np.repeat(np.eye(3)[None, ...], N, axis=0) * 100.0,
"coords": np.random.rand(N, 20, 3) * 100.0,
Comment on lines +92 to +103
### 4) Install and test

In a clean env (recommended via `uv`):

```bash
uv run --with dpdata --with numpy python3 - <<'PY'
import dpdata
from dpdata.format import Format

# importing dpdata will load entry points (dpdata.plugins)
print('random' in Format.get_formats())
PY
@njzjz-bot
Copy link
Contributor Author

CodSpeed flagged a small import-time regression.

To minimize any chance of CI noise, I reverted the .gitignore changes in this PR (keeping this PR focused on docs-only skill addition).

Authored by OpenClaw (model: gpt-5.2)

@njzjz-bot
Copy link
Contributor Author

Note: uv.lock is a local dev artifact and is not committed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
skills/dpdata-plugin/SKILL.md (1)

108-113: Add a key-collision check to the debug checklist

Please add a checklist bullet to verify the registered key (e.g., random) does not collide with existing built-in or external plugin keys, since later-loaded plugins can overwrite prior registrations silently.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/dpdata-plugin/SKILL.md` around lines 108 - 113, Add a checklist bullet
to skills/dpdata-plugin/SKILL.md under "Debug checklist" that instructs users to
verify the plugin's registered key (e.g., the string passed to `@Format.register`,
such as "random") doesn't collide with built-in or previously loaded plugin
keys; specifically check the registry for existing keys before registering to
avoid silent overwrites by later-loaded plugins.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/dpdata-plugin/SKILL.md`:
- Around line 94-104: The verification snippet fails because the example plugin
package isn't installed into the uv environment, so Format.get_formats() won't
include the "random" entry; fix the SKILL.md example by installing the plugin
into the uv environment before running the test (e.g., run uv pip install -e .
prior to uv run) so that dpdata's entry points are registered and
Format.get_formats() returns True.

---

Nitpick comments:
In `@skills/dpdata-plugin/SKILL.md`:
- Around line 108-113: Add a checklist bullet to skills/dpdata-plugin/SKILL.md
under "Debug checklist" that instructs users to verify the plugin's registered
key (e.g., the string passed to `@Format.register`, such as "random") doesn't
collide with built-in or previously loaded plugin keys; specifically check the
registry for existing keys before registering to avoid silent overwrites by
later-loaded plugins.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d1ada6e5-1002-453c-aacd-8ad8e4814222

📥 Commits

Reviewing files that changed from the base of the PR and between d68b700 and 285cbdd.

📒 Files selected for processing (1)
  • skills/dpdata-plugin/SKILL.md

Comment on lines +94 to +104
In a clean env (recommended via `uv`):

```bash
uv run --with dpdata --with numpy python3 - <<'PY'
import dpdata
from dpdata.format import Format

# importing dpdata will load entry points (dpdata.plugins)
print('random' in Format.get_formats())
PY
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the current install/test snippet does not install the example plugin package.
fd -a SKILL.md | xargs rg -n -C2 "uv run --with dpdata --with numpy|Format.get_formats|uv pip install -e \."

Repository: deepmodeling/dpdata

Length of output: 803


🏁 Script executed:

# Find pyproject.toml or setup.py in the skills/dpdata-plugin directory
find skills/dpdata-plugin -maxdepth 2 -name "pyproject.toml" -o -name "setup.py"

Repository: deepmodeling/dpdata

Length of output: 45


🏁 Script executed:

# Check the overall structure of the skill directory
cd skills/dpdata-plugin && find . -maxdepth 2 -type f | head -20

Repository: deepmodeling/dpdata

Length of output: 73


🏁 Script executed:

# Search for 'random' format definition in the skills directory
rg -r "random" skills/dpdata-plugin/ | grep -i "format\|class"

Repository: deepmodeling/dpdata

Length of output: 45


🏁 Script executed:

# List the entire structure of skills/dpdata-plugin
cd skills/dpdata-plugin && ls -la

Repository: deepmodeling/dpdata

Length of output: 231


🏁 Script executed:

# Look for 'random' format implementation in the main dpdata codebase
rg -r "random" dpdata/ | grep -i "class.*Format\|def.*random" | head -10

Repository: deepmodeling/dpdata

Length of output: 45


🏁 Script executed:

# Check if there's a README or explanation about skills in the repo
find . -maxdepth 2 -name "README*" -o -name "AGENTS*"

Repository: deepmodeling/dpdata

Length of output: 113


🏁 Script executed:

# Check the AGENTS.md file to understand the context
cat AGENTS.md

Repository: deepmodeling/dpdata

Length of output: 7323


🏁 Script executed:

# Check the plugin_example directory
ls -la plugin_example/

Repository: deepmodeling/dpdata

Length of output: 359


🏁 Script executed:

# Read the full SKILL.md file to get complete context
cat skills/dpdata-plugin/SKILL.md

Repository: deepmodeling/dpdata

Length of output: 3238


Verification command must install the plugin package first

The test on Line 97 will print False instead of True because the example plugin package (dpdata_random) is never installed in the uv run environment. Without uv pip install -e ., the entry point is not registered and plugin discovery fails.

✅ Suggested fix
 ### 4) Install and test
 
 In a clean env (recommended via `uv`):
 
 ```bash
+uv pip install -e .
 uv run --with dpdata --with numpy python3 - <<'PY'
 import dpdata
 from dpdata.format import Format
 
 # importing dpdata will load entry points (dpdata.plugins)
 print('random' in Format.get_formats())
 PY
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
In a clean env (recommended via `uv`):

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/dpdata-plugin/SKILL.md` around lines 94 - 104, The verification
snippet fails because the example plugin package isn't installed into the uv
environment, so Format.get_formats() won't include the "random" entry; fix the
SKILL.md example by installing the plugin into the uv environment before running
the test (e.g., run uv pip install -e . prior to uv run) so that dpdata's entry
points are registered and Format.get_formats() returns True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants